﻿using System;
using System.IO;
using System.Reflection;
using System.Web;
using System.Web.UI.HtmlControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using log4net;
namespace AnyOffice.general.system.qikan
{
    public partial class delete : ModulePage
    {
        private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!this.Page.IsPostBack)
            {
                int num = (Request.QueryString["disk_id"] == null) ? 0 : int.Parse(Request.QueryString["disk_id"].ToString());
                new QikanDao().Delete(base.Conn, num);
                try
                {
                    string path = Server.MapPath("/attachment/qikan/diskpath" + num.ToString());
                    if (Directory.Exists(path))
                    {
                        Directory.Delete(path, true);
                    }
                }
                catch (Exception exception)
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("", exception);
                    }
                }
                base.CloseConn();
                Response.Redirect("index.aspx");
            }
        }
    }
}
